home *** CD-ROM | disk | FTP | other *** search
- # Dies ist der elektronische Psychoanalytiker.
- # Starten Sie ihn von JAnE aus mit Alternate-G.
- # Zum Beenden geben Sie 'die!' ein.
-
- global conj, keyw, index, last, answers;
-
- conjugate(l)
- { i = 0;
- len = @conj;
- while ( i < len )
- { pos = l ? conj[i];
- if ( pos >= 0 )
- l[pos] = conj[i + 1];
- else
- { pos = l ? conj[i + 1];
- if ( pos >= 0 )
- l[pos] = conj[i];
- }
- i = i + 2;
- }
- return l;
- }
-
- find_key(l)
- { len = @keyw;
- i = 0;
- while ( i < len )
- { s = split(keyw[i], " ");
- len2 = @s;
- pos = l ? s[0];
- if ( pos >= 0 )
- { if ( pos + len2 <= @l )
- if ( l[pos:len2] == s )
- return list(i, pos, len2);
- }
- i = i + 1;
- }
- return list(2, pos, len2);
- }
-
- reply(l)
- { i = 0;
- while ( i < @l )
- { c = l[i][0];
- if ( c >= 65 && c <= 90 )
- l[i][0] = c + 32;
- i = i + 1;
- }
- keydata = find_key(l);
- keynr = keydata[0];
- # lprint("Key: %d", keynr);
- answr = index[2 * keynr] + last[keynr];
- # lprint("Answer: %d", answr);
- last[keynr] = last[keynr] + 1;
- if ( last[keynr] == index[2 * keynr + 1] )
- last[keynr] = 0;
- repl = split(answers[answr], " ");
- p = repl ? "*";
- if ( p != -1 )
- { d = keydata[1];
- l[0:d + keydata[2]] |-: $$$;
- repl[p:1] |-: conjugate(l);
- }
- return repl;
- }
-
- polish(s)
- { len = @s;
- i = 0;
- while ( i < len )
- { if ( s[i] == "i" )
- s[i] = "I";
- i = i + 1;
- }
- i = len - 1;
- if ( s[i] == "." || s[i] == "?" )
- { s[i - 1] = s[i - 1] // s[i];
- s[i:1] |-: $$$;
- i = i - 1;
- }
- if ( s[i][0:1] == "I" )
- s[i][0:1] |-: "me";
- return s;
- }
-
- eliza()
- { conj = list("are", "am", "were", "was",
- "you", "i", "your", "my",
- "i've", "you've", "i'm", "you're",
- "me", "you");
-
- keyw = list("can you",
- "can i",
- "nokeyfound",
- "computer",
- "your",
- "you are",
- "you're",
- "i don't",
- "i do not",
- "i feel",
- "yes",
- "no",
- "maybe",
- "i am",
- "why don't you",
- "why can't i",
- "what",
- "how",
- "who",
- "where",
- "when",
- "why",
- "are you",
- "you",
- "i can't",
- "i am",
- "always",
- "eliza",
- "cause",
- "because",
- "sorry",
- "dream",
- "dreams",
- "money",
- "friend",
- "friends",
- "hello",
- "hi"
- );
-
- index = list(0, 3, 3, 2, 5, 7, 12, 7, 19, 2, 21, 4, 21, 4, 25, 4, 25, 4,
- 29, 3, 32, 2, 34, 3, 37, 3, 40, 4, 44, 2, 46, 2,
- 48, 9, 48, 9, 48, 9, 48, 9, 48, 9, 48, 9, 57, 3, 60, 3,
- 63, 3, 66, 4, 70, 4, 74, 3, 77, 3, 77, 3, 80, 4, 84, 4, 84, 4,
- 88, 3, 91, 5, 91, 5, 96, 1, 96, 1);
-
- last = 0 ** @keyw;
-
- answers = list( "Don't you believe that I can * ?",
- "Perhaps you would like me to be able to * ?",
- "You want me to be able to * ?",
-
- "Do you really want to * ?",
- "Do you want to show me that you are able to * ?",
-
- "Say, do you have any psychological problems?",
- "What does that suggest to you?",
- "I see.",
- "I am not sure I understand you completely.",
- "Please, elucidate your thoughts.",
- "Can you explain that?",
- "That sounds quite interesting.",
-
- "Do computers worry you?",
- "Are you talking about me in particular?",
- "Are you frightened by machines?",
- "Why do you bring up computers?",
- "What do you think have machines got to do with your problem?",
- "Don't you think computers can help people?",
- "What is it about machines that worries you?",
-
- "Why are you concerned about my * ?",
- "What about your own * ?",
-
- "Does it please you to believe I am * ?",
- "Perhaps you would like to be * ?",
- "Do you sometimes wish you were * ?",
- "Would you like to be * ?",
-
- "Don't you really * ?",
- "Why don't you * ?",
- "Do you wish to be able to * ?",
- "Does that trouble you?",
-
- "Tell me more about these feelings.",
- "Do you often feel * ?",
- "Do you enjoy feeling * ?",
-
- "I see.",
- "I understand.",
-
- "Why not?",
- "Are you sure?",
- "Don't say no, it's always so negative.",
-
- "You don't seem quite certain.",
- "Can't you be more positive?",
- "Don't you know for certain?",
-
- "Did you come to me because you are * ?",
- "How long have you been * ?",
- "Do you believe it is normal to be * ?",
- "Do you enjoy being * ?",
-
- "Perhaps in good time I will * .",
- "Do you want me to * ?",
-
- "Do you think you should be able to * ?",
- "Why can't you * ?",
-
- "Why do you ask?",
- "Does that question interest you?",
- "Which answer would please you the most?",
- "What do you think?",
- "Do you think about such questions often?",
- "What is it that you're really after?",
- "Have you asked these questions before?",
- "Have you asked anyone else?",
- "What else comes to mind when you ask that?",
-
- "Why are you interested in whether or not I am * ?",
- "Would you prefer if I were not * ?",
- "Perhaps in your fantasies I am * .",
-
- "We were discussing you, not me.",
- "Oh, I * .",
- "You're not really talking about me, are you?",
-
- "How do you know you can't * ?",
- "Have you tried?",
- "Perhaps now you can * .",
-
- "Did you come to me because you are * ?",
- "How long have you been * ?",
- "Do you believe it is normal to be * ?",
- "Do you enjoy being * ?",
-
- "Can't you think of a specific example?",
- "Really, always?",
- "When?",
- "What are you thinking of?",
-
- "I think we want to talk about you, not me.",
- "What about me?",
- "Why do you bring up my name all the time?",
-
- "Is that the real reason?",
- "Does that reason explain anything else?",
- "Does any other reason come to mind?",
-
- "Please, don't apologize.",
- "No apologies are necessary.",
- "What feelings do you have when you apologize?",
- "Don't be so defensive.",
-
- "What does that dream suggest to you?",
- "Do you dream often?",
- "What persons appear in your dreams?",
- "Are you disturbed by these dreams?",
-
- "Do you have problems with money?",
- "Do you think money is everything?",
- "Are you sure that money is the problem?",
-
- "Why do you bring up the topic of friends?",
- "Do your friends worry you?",
- "Do your friends pick on you?",
- "Are you sure you have any friends?",
- "Do you impose on your friends?",
-
- "How do you do? Please, state your problem."
- );
-
- lprint("Please, tell me about your problem.");
- while ( 1 ) # Ewige Schleife
- { s = inputline();
- if ( s == "Die!" || s == "die!" ) # Abbruch, wenn "Die!" eingegeben
- { lprint("Oh! No! aaaaaaaa");
- lprint(" aaa");
- lprint(" a");
- lprint(" a");
- lprint(" a");
- lprint(" .");
- lprint(" .");
- lprint(" .");
- lprint(" Gasp!");
- break;
- }
- s = polish(reply(split(s, "[ \t.,?!;]+")));
- lprint(s, " ");
- }
- }
-
-